import Alarm from '@/pages/alarm'
import SysLog from '@/pages/log/indexSysLog'
import SetView from '@/pages/set'
import NotFound from '@/pages/NotFound'
import { SidebarRouterProps } from './routerInterface'
import { Navigate } from 'react-router-dom'
import HomeView from '@/pages/home'
import { AlarmIcon, OperateLogIcon } from '@/components/Icon'
/**先这样写定的一个可见角色 */
let defaultRole = ['sacAdmin', 'sacDefaultAdmin']
/**假设当前登录的角色是：smcAdmin */
let currentRole = 'sacAdmin'
const getSidebarRouter = () => {
	if (!window.MoSource) {
		window.MoSource = 'sac'
	}
	let sidebarRouter: SidebarRouterProps[] = [
		{
			id: `/`,
			path: `/`,
			isShowInMenus: false,
			title: '',
			element: <Navigate to="home" />,
			meta: {
				roles: defaultRole,
			},
		},
		{
			id: `/home`,
			path: `/home`,
			isShowInMenus: false,
			title: '首页',
			element: <HomeView />,
			meta: {
				roles: defaultRole,
			},
		},
		{
			id: `/log/operation`,
			path: `/log/operation`,
			title: '操作日志',
			icon: <OperateLogIcon className="iconCls"></OperateLogIcon>,
			element: <SysLog />,
			meta: {
				roles: defaultRole,
			},
		},
		{
			id: `/alarm`,
			path: `/alarm`,
			title: '告警管理',
			icon: <AlarmIcon className="iconCls"></AlarmIcon>,
			meta: {
				roles: defaultRole,
			},
			children: [
				{
					id: `/alarm`,
					path: `/alarm`,
					isShowInMenus: false,
					title: '告警管理',
					element: <Alarm />,
					meta: {
						roles: defaultRole,
					},
				},
				// {
				// 	id: `/alarm/:id`,
				// 	path: `/alarm/:id`,
				// 	isShowInMenus: false,
				// 	title: '告警',
				// 	element: <AlarmDetailView />,
				// 	meta: {
				// 		roles: defaultRole,
				// 	},
				// },
			],
		},
		{
			id: `/set/*`,
			path: `/set/*`,
			isShowInMenus: false,
			title: '个人设置',
			element: <SetView />,
			meta: {
				roles: defaultRole,
			},
		},
		{
			id: `/*`,
			path: `/*`,
			title: '未找到',
			isShowInMenus: false,
			meta: {
				roles: defaultRole,
			},
			element: <NotFound />,
		},
	]
	return {
		sidebarRouter,
	}
}

export { currentRole, getSidebarRouter }
